<%-- 
    Document   : Subcriber
    Created on : 14-08-2014, 10:58:44
    Author     : NGOCLINH-PC
--%>

<%@page import="Data.Member"%>
<%@page import="Data.Category"%>
<%@page import="java.util.ArrayList"%>
<%@page import="Data.Subcriber"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>

<div class="primarysanpham">
    <div class="menusanpham">
        <div class="menusanpham1">
            
        </div>
    </div>
    <div class="tablesanpham">
        <div class="tablesanpham1">
            <form action="" method="post" name="frm" id="frm">
                <h2 style="padding: 10px; color: #999;">Management Subcirber</h2>
                <hr />
                <table width="100%" border="1" cellspacing="0" cellpadding="4" id="mytable">
                    <tr>
                        <th scope="col">STT</th>
                        
                        <th scope="col">Member</th>
                        <th scope="col">Category</th>
                        <th scope="col">Actions</th>
                    </tr>
                    <%
                        Subcriber ct = new Subcriber();
                        ArrayList<Subcriber> p = ct.Sselect();
                        int k = 1;
                        if (p.size() > 0) {
                            for (int i = 0; i < p.size(); i++) {
                                Subcriber pay = p.get(i);
                                out.print("<tr>");
                                out.print("<td>" + k++ + "</td>");
                                //out.print("<td><input name='' type='checkbox' value='' /></td>");
                                // lay member name
                                Member m = new Member();
                                ArrayList<Member> mb = m.MselectById(pay.getMemberID());
                                for (int a = 0; a < mb.size(); a++) {
                                    Member ma = mb.get(a);
                                    out.print("<td>" + ma.getUsername() + "</td>");
                                }

                                ///lay category name
                                Category c = new Category();
                                ArrayList<Category> ac = c.CselectById(pay.getCategoryID());
                                for (int j = 0; j < ac.size(); j++) {
                                    Category ca = ac.get(j);
                                    out.print("<td>" + ca.getCategoryName() + "</td>");
                                }
                                ////

                                out.print("<td><span class='xoa'><a href='../SubcriberPR?AsubcriberID=" + pay.getERECID() + "' onclick='return confirm(\"Do you want delete!\")'><img src='../admin/image/deleteBtn.gif' alt='deleteBtn' /></a></span></td>");
                                out.print("</tr>");
                            }
                        }

                    %>



                </table>
                <div class="pages"></div>
            </form>
        </div>
    </div>
</div>
